<?php
class DateUtility
{
    public static function convertFormat($oldDate, $oldFormat, $newFormat)
    {
        $newDate = DateTime::createFromFormat($oldFormat, $oldDate);
        if(!$newDate)
        {
            return false;
        }
        return $newDate->format($newFormat);
    }

    public static function calcYearOfBirth($birthday)
    {
        return substr($birthday, 0, 4);
    }

    public static function calcAge($birthday)
    {
        return date('Y') - self::calcYearOfBirth($birthday);
    }
}